/* Type for the data stack of the virtual machine */

typedef struct Datum_s {	/* VM Data stack type */
	short datatype;		/*INT,FLOAT,BOOL,CHAR*/
	union {
		int			ival;		/* Data value (integer) */
		float			fval;		/* Data value (float) */
		double		dval;		/* Data value (double) */
		char			cval;		/* Data value (character) */
		bool			bval;		/* Data value (boolean) */
		Symbol_t*	ptr_sym;	/* Pointer to a symbol */
	} u;
} Datum_t;

/* Virtual Machine Instruction type */
//typedef void (*Inst_t)();	/* Machine Instruction */
#define	STOP	(Inst_t) 0	/* STOP Instruction */

/* Functions provided by code.c */

extern Datum_t pop();

extern Inst_t	prog[];				/* Program Memory */
extern Inst_t	*code(Inst_t);		/* Lay down new program code */
extern Inst_t	*ptr_base;			/* Start of current definition */
extern Inst_t	*ptr_prog;			/* Location of next op-code */

extern void		initcode();			/* Init Virtual Machine */
extern void		execute(Inst_t*);	/* Execute Virtual Code */
extern void		define(Symbol_t *);

/* Define Virtual Machine Op-Codes */
extern void		eval(), assign(), bltin();
extern void		varpush(), constpush(), drop(), varread();
extern void		call(), arg(), argassign(), procret(), funcret();

extern void		hoc_add(), hoc_sub(), hoc_mul(), hoc_div();
extern void		hoc_mod(), hoc_power();

extern void		hoc_negate();

extern void		print(), prexpr(), prstr();

extern void		hoc_gt(), hoc_ge(), hoc_lt(), hoc_le();
extern void		hoc_eq(), hoc_ne(), hoc_and(), hoc_or(), hoc_not();

extern void		ifcode(), whilecode();
